import bus from "@/bus"
let data = {
  status: 'pass',
  totalItem: 1,
  pageSize: window.$pageSize / 2,
  currentPage: 1,
  columns: [{
    title: '模板名称',
    key: 'freightName',
    minWidth: 200,
    tooltip: true
  }, {
    title: '配送描述',
    key: 'deliveryDescribe',
    minWidth: 300,
    tooltip: true
  }, {
    title: '送货到（国内）',
    key: 'distributorNames',
    minWidth: 400,
    tooltip: true,
    render: (h, p) => {
      let text = p.row.isSystemed ? '未被划分的经销商自动归于默认模板' : p.row.distributorNames
      return <div>{text}</div>
    }
  }, {
    title: '计费规则',
    minWidth: 260,
    render: (h, p) => {
      let text = ''
      if (p.row.freightType === "FREIGHT") text = '固定运费' + p.row.fixedFee + '元'
      if (p.row.freightType === "FREIGHT_FREE") text = '每张订单不满' + p.row.defaultFee + '元，运费' + p.row.extraFee + '元'
      return h('div', text)
    }
  }, {
    title: '最后编辑时间',
    key: 'modifyDate',
    minWidth: 170
  }, {
    title: '启用',
    key: 'isEnabled',
    minWidth: 100,
    render: (h, p) => {
      return h('div', p.row.isEnabled ? '是' : '否')
    }
  }, {
    title: '操作',
    width: 160,
    align: 'right',
    fixed: 'right',
    render: (h, params) => {
      let editBtn = h('Button', {
        class: 'mr',
        props: {
          size: 'small',
          type:'primary'
        },
        on: {
          click: () => {
            bus.$emit('onEditShop', {row: params.row})
          }
        }
      }, '修改')
      let openBtn = h('Button', {
        class: 'mr',
        props: {
          size: 'small',
          type:'warning',
          disabled: params.row.isSystemed
        },
        on: {
          click: () => {
            bus.$emit('onOpenShop', {row: params.row})
          }
        }
      }, params.row.isEnabled ? '禁用' : '启用')
      return h('div', [editBtn, openBtn])
    }
  }],
  data: []
}
export default data
